const TransformPages = require("uni-read-pages");
const Timestamp = new Date().getTime();
const { webpack } = new TransformPages();
const plugins = [
  new webpack.DefinePlugin({
    ROUTES: webpack.DefinePlugin.runtimeValue(() => {
      const tfPages = new TransformPages({
        includes: ["path", "name", "aliasPath"],
      });
      return JSON.stringify(tfPages.routes);
    }, true),
  }),
];
// 生产环境下
module.exports = {
  transpileDependencies: ["uview-ui"],
  configureWebpack: {
    output: {
      // 输出重构  打包编译后的 文件名称  【模块名称.版本号.时间戳】
      filename: `static/js/[name].${Timestamp}.js`,
      chunkFilename: `static/js/[name].${Timestamp}.js`,
    },
    plugins,
  },
};
